#include<iostream> 
using namespace std;
int fn(int x){
	int t = 0,num = x;
	while(x){
		t = x % 10;
		if(t == 2 || t == 0){
			return num * num;
		}
		x = x / 10;
	}
	return 0;
}
int main(void){
	int sum = 0;
	for(int i = 1;i <= 2020;i++){
		sum += fn(i);
	}
	cout << sum; 
	return 0;
}
